//
//  LunBoDetailWebViewController.m
//  Travel assistant
//
//  Created by 杨帆 on 16/3/11.
//  Copyright © 2016年 旅游助手. All rights reserved.
//

#import "LunBoDetailWebViewController.h"
#import <UMSocial.h>
@interface LunBoDetailWebViewController ()<UMSocialUIDelegate>

@property (nonatomic,strong) UIWebView *webView;

@end

@implementation LunBoDetailWebViewController




- (void)viewDidLoad {
    [super viewDidLoad];

    self.tabBarController.tabBar.hidden = YES;
    
    [self addWebView];

    
    
}


-(void)addWebView{
    
    
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 64, Screen_W, Screen_H)];
    
    self.webView.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:self.webView];
    
    NSString *url = self.webUrl;
    
    NSURLRequest *request = [[NSURLRequest alloc]initWithURL:[NSURL URLWithString:url]];
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        [self.webView loadRequest:request];
        
    });
    
  
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, Screen_W, 64)];
    view.backgroundColor = [UIColor clearColor];
    
    [self.view addSubview:view];
    
    UIButton *left=[UIButton buttonWithType:UIButtonTypeSystem];
    
    left.frame = CGRectMake(10, 20, 40, 44);
    [left setTitle:@"Back" forState:(UIControlStateNormal)];
//    [right setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [left addTarget:self action:@selector(disMissCurrences:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:left];
    
    
    UIButton *right = [UIButton buttonWithType:(UIButtonTypeSystem)];
    right.frame = CGRectMake(KScreenWidth- 50, 20, 40, 44);
    
    [right setTitle:@"Share" forState:(UIControlStateNormal)];
    [right addTarget:self action:@selector(shareAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    [self.view addSubview:right];
    
    UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake(Screen_W/2-60, 20, 120, 44)];

    lable.text = self.Title;
    lable.backgroundColor = [UIColor clearColor];
    
    [self.view addSubview:lable];
    
    
}

-(void)disMissCurrences:(UIButton *)sender{
    
    
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
    
    
    
}

-(void)shareAction:(UIButton *)sender{
    
    [UMSocialSnsService presentSnsIconSheetView:self
                                         appKey:@"52b13dc556240b55870e7148"
                                      shareText:self.webUrl
                                     shareImage:nil
                                shareToSnsNames:@[UMShareToSina,UMShareToQQ,UMShareToQzone,UMShareToWechatSession,UMShareToWechatTimeline]
                                       delegate:self];
    
    
}

@end
